<template>
  <div class="container">
    <!-- <el-page-header title="企业门户网站管理系统" icon="">
      <template #content>
        <span class="text-large font-600 mr-3"> 首页 </span>
      </template>
    </el-page-header> -->
    <PageHeader title="企业门户网站管理系统" content="首页" />
    <el-card class="card-box">
      <el-row type="flex" align="middle">
        <el-col :span="2"> <el-avatar :size="50" :src="avatarUrl" /></el-col>
        <el-col :span="22">
          <h3>欢迎{{ loginStore.userInfo.username }}回来！</h3>
        </el-col>
      </el-row>
    </el-card>
    <el-card class="card-box">
      <template #header> <span>公司产品</span> </template>
      <el-carousel :interval="4000" type="card" height="200px">
        <el-carousel-item v-for="item in 6" :key="item">
          <h3 text="2xl" justify="center">{{ item }}</h3>
        </el-carousel-item>
      </el-carousel>
    </el-card>
  </div>
</template>
<script setup lang="ts">
import { useLoginStore } from '@/stores/index'
import { computed, ref, toRaw } from 'vue'
import PageHeader from '@/components/layout/PageHeader.vue'
const loginStore = useLoginStore()
console.log(toRaw(loginStore.userInfo))

const circleUrl = ref('https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png')
const avatarUrl = computed(() => {
  return loginStore.userInfo.avatar
    ? `http://localhost:3000${loginStore.userInfo.avatar}`
    : circleUrl.value
})
</script>
<style lang="scss" scoped>
.card-box {
  margin-top: 20px;
}
.el-carousel__item h3 {
  color: #475669;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
  text-align: center;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
</style>
